/*  dreic -- a compiler for Drei
 *
 *  $Id: ParserTest.scala 2976 2006-10-18 14:34:08Z mihaylov $
 */

package dreic


/**
 * A small parser test class; it reads in a file and prints out
 * every/the first syntax error that is found. Programs which
 * do not yield error messages are supposed to be syntactically
 * correct.
 *
 * usage: scala dreic.ParserTest <file.drei>
 */
object ParserTest {
  import java.io.{FileInputStream, IOException}

  def main(args: Array[String]): Unit = {
    if (args.length == 0) {
      Report.fail("usage: scala dreic.ParserTest <file.drei>")
    }
    try {
      val in = new FileInputStream(args(0))
      new Parser(in).parse
      in.close()
      Report.exit()
    }
    catch {
      case e: IOException => Report.fail(e.getMessage())
    }
  }

}
